/*import webpack from "webpack"
import htmlWebpackPlugin from "html-webpack-plugin"*/
var webpack=require("webpack");
var htmlWebpackPlugin=require("html-webpack-plugin");
const ExtractTextPlugin = require("extract-text-webpack-plugin");

module.exports = {
    entry: __dirname + "/src/main.js",
    output: {
        path: __dirname + "/dist",
        // filename:"bundle.js",
        filename: "js/[name]-[hash].js"
    },
    devServer: {
        contentBase:"./public",
        historyApiFallback:true,
        inline:true
    },
    module:{
        loaders:[
            {
                test: /\.css$/,
                use: ExtractTextPlugin.extract({
                    fallback:"style-loader",
                    use:"css-loader"
                })
                // [ 'style-loader', 'css-loader' ]  /*!使同时一个文件能使用不同类型的loader*/
            },
            {
                test:/\.js$/,
                exclude:/node_modules/,
                loader:"babel-loader",
                /*query:{
                    presets:['es2015']
                }*/
            },
            {
                test:/\.(png|jpg|gif)$/,
                loader:"url-loader?limit=50000&name=img/[name].[hash:8].[ext]"
            },
            {
                test:/\.html$/,
                loader:"html-withimg-loader"
            }
        ]
    },
    plugins:[
        new webpack.BannerPlugin("殷付文的webpack,版权内容"),
        new htmlWebpackPlugin({
            template:__dirname+"/public/index.html"
        }),
        new webpack.optimize.UglifyJsPlugin(),
        new ExtractTextPlugin({
            filename:'css/[name].css'
        })
    ]
}